﻿namespace IBTrader.Charts.Drawing
{
    using IBTrader.Modules.Read;
    using System;
    using System.Collections.Concurrent;
    using System.Collections.Generic;
    using System.Drawing;
    using System.Linq;

    class ChartLines : ChartLine
    {
        private readonly List<Item> items = new List<Item>();
        internal ChartLines(Worker worker, Color color) : base(worker, color) { Width = 5; }
        internal void Add(object _, Item item)
        {
            items.Add(item);
            item.Lines.ToList().ForEach(line => Lines.Add(line));
        }
        public override void Draw(IGraphics g, Charts.Region region)
        {
            foreach (var item in items)
                Draw(g, region, item.Color, item.Lines);
        }
        internal class Item : EventArgs
        {
            public IEnumerable<Line> Lines { get; set; }
            public Color Color { get; set; }
        }
    }
}